﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = "_Layout";
}
<body class="layui-anim layui-anim-up">
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="/Admin/Admin/Index">首页</a>
            <a>
                <cite>会员实名</cite>
            </a>
        </span>
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
            <i class="layui-icon" style="line-height:30px">ဂ</i>
        </a>
    </div>
    <div class="x-body">
        <table class="layui-table" lay-data="{ url:'/Admin/Real/GetRealUser', page:true, id:'real'}" lay-filter="real">
            <thead>
                <tr>
                    <th lay-data="{field:'', width:'7%', sort: true,type:'numbers'}">ID</th>
                    <th lay-data="{field:'UserName', width:'10%'}">用户名</th>
                    <th lay-data="{field:'WX' , width:'7%', templet: '#state'}">状态</th>
                    <th lay-data="{field:'Name', width:'7%'}">真实姓名</th>
                    <th lay-data="{field:'CarNO', width:'15%'}">身份证号</th>
                    <th lay-data="{field:'', width:'20%', templet: '#carimg'}">身份证</th>
                    <th lay-data="{field:'', width:'20%', templet: '#photo'}">照片</th>
                    <th lay-data="{field:'AddDT', width:'10%',templet: '<div>{{ HsCms.ToDate(d.AddDT) }}</div>'}">申请时间</th>

                    <th lay-data="{field:'CarImgZ' , width:'10%' , templet: '#barDemo'}">操作</th>
                </tr>
            </thead>
        </table>

        <script type="text/html" id="state">
            {{#  if(d.State==0){ }}
            <span>待审核</span>
            {{#  }else if(d.State==1){ }}
            <span>已通过</span>
            {{#  }else{ }}
            <span>未通过</span>
            {{#  } }}
        </script>


        <script type="text/html" id="carimg">
            {{#  if(d.CarImgZ){ }}
            <a href="{{d.CarImgZ}}" target="_blank">{{d.CarImgZ}}</a>
            <br />
            <a href="{{d.CarImgF}}" target="_blank">{{d.CarImgF}}</a>
            {{#  }else{ }}
            <span>空</span>
            {{#  } }}
        </script>
        <script type="text/html" id="photo">
            {{#  if(d.PhotoZ){ }}
            <a href="{{d.PhotoZ}}" target="_blank">{{d.PhotoZ}}</a>
            <br />
            <a href="{{d.PhotoF}}" target="_blank">{{d.PhotoF}}</a>
            {{#  }else{ }}
            <span>空</span>
            {{#  } }}
        </script>
        <script type="text/html" id="barDemo">
            {{#  if(d.State==0){ }}
            <a class="layui-btn layui-btn-xs" lay-event="tg">通过</a>
            {{#  } }}
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>
    </div>
    <script>
layui.use(['laydate', 'table', 'form','layer'], function () {
            var laydate = layui.laydate;
            var table = layui.table;
            var $ = layui.jquery;
            var form = layui.form;
            var layer=layui.layer;

            //监听行工具事件
            table.on('tool(real)', function (obj) {
                var data = obj.data;
                //console.log(obj)
                if (obj.event === 'del') {
                    layer.confirm('真的删除行么', function (index) {

                        $.ajax({
                            type: "post",
                            url: "/Admin/Real/Del",
                            data: { id: data.Id },
                            success: function (result) {
                                if (result.state == "ok") {
                                    layer.msg(result.msg)
                                } else {
                                    layer.msg(result.msg)
                                }
                            }
                        })

                        obj.del();

                    });
                } else if (obj.event === 'tg') {
                   $.ajax({
                    type: "post",
                    url: "/Admin/Real/UpState",
                    data: { id: data.Id ,state:1},
                    success: function (result) {
                        if (result.state == "ok") {
                            layer.msg(result.msg)
                        } else {
                            layer.msg(result.msg)
                        }
                    }
                   })
                }
            });


        });</script>
</body>

